package com.example.dao.dto;

import com.example.common.Constants;
import com.example.validation.PasswordMatches;
import com.example.validation.ValidEmail;
import com.example.validation.ValidPassword;

import lombok.*;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 功能描述
 * 页面传过来的用户数据
 * @author: jimmy
 * @date: 2023年12月25日 14:41
 */
@PasswordMatches
@Data
public class UserDto implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户账号
     */
    @Size(min = 3, max = 20, message = "{Size.userDto.username}")
    private String username;

    /**
     * 用户姓名
     */
    @Size(min = 1, max = 20, message = "{Size.userDto.name}")
    private String name;

    /**
     * 密码
     */
    @ValidPassword
    private String password;

    /**
     * 重复密码
     */
    private String matchingPassword;

    /**
     * 用户邮箱
     */
    @Size(min = 1, max = 50, message = "{Size.userDto.email}")
    @ValidEmail
    private String email;

    /**
     * 用户手机
     */
    @Pattern(regexp = Constants.PATTERN_MOBILE, message = "{Size.userDto.mobile}")
    private String mobile;
}
